<?php

class Admin_Model_DbTable_Bassinderetention extends Zend_Db_Table {
	
    protected $_name = 'bassinderetention';
    /**
		Recuperer bassin par son id
     */
    public function getBassin($idbassin) {
        $idbassin = (int)$idbassin;
        $row = $this->fetchRow('idbassinderetention = ' . $idbassin);
        if (!$row) {
            throw new Exception("Count not find row $idbassin");
        }
        return $row->toArray();    
    }
    
    public function addBassin($nombassin) {
        $data = array(
            'nombassin' => $nombassin,
        );
        $this->insert($data);
    }
    
    public function updateBassin($idbassin, $nombassin) {
         $data = array(
            'nombassin' => $nombassin,
        );
        $this->update($data, 'idbassin = '. (int)$idbassin);
    }
    
    
	function deleteBassin($idbassin) {
		$this->delete ( 'idbassin =' . ( int ) $idbassin );
	}
    /**
     * 
     * @return  
     */
    public function getAllBassin() {  
    	$all = $this->fetchAll();
        $bassins = array();
     
        $bassins['total'] = count($all->toArray());
        $bassins['rows'] = $all->toArray();
        return $bassins ;
    }    
    
}
